package com.jf.cloud.service.sysmanager.support.web;

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * User: LangK
 * Date: 2017/9/9
 * Time: 14:17
 * Description:
 */
@Component
public class ErrorHandleComponent implements EmbeddedServletContainerCustomizer {

    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
        container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/jsp/error_400_500.jsp"));
        container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/jsp/error_400_500.jsp"));
        container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/jsp/error_400_500.jsp"));
    }

}